<template>
  <div>
    <div v-if="!item">数据加载中...</div>
    <div v-else>
			<h2>
				<span>{{ name }}---{{ id }}</span>
			</h2>
      <van-cell :title="v" v-for="(v, i) in item.children" :key="i" />
    </div>
  </div>
</template>


<script>
import axios from "axios";
export default {
  name: "carDetail",
  props: ["id", "name"],
  data() {
    return {
      item: null,
    };
  },
  methods: {
    async fetchCarDetail() {
      const resp = await axios.get("/api/car/detail", {
        params: { id: this.id },
      });
      this.item = resp.data.data;
    },
  },
  created() {
    this.fetchCarDetail();
  },
};
</script>